home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995…tember: Reference Library / Dev.CD Sep 95 RL / Dev.CD Sep 95 RL.toast / mac / Technical Documentation / develop / develop Issue 19 code / SimpliFace_V2 / Sources / CTdebugWriteln.a < prev    next >
Encoding:
Text File  |  1994-04-15  |  4.6 KB  |  214 lines  |  [TEXT/MPS ]

  1. ; Copyright © Apple Computer Inc.
  2. ; UDebug assembly language routines
  3.  
  4.                 Blanks        On
  5.                 String        AsIs
  6.                 Case        On
  7.                  
  8.                 Print        Off
  9.                 Include     'Macros.a'
  10.  
  11.                 Include        'IntEnv.a'
  12.                 Include        'ProgStrucMacs.a'
  13.                 Include        'FlowCtlMacs.a'
  14.  
  15.                 Print        On
  16.  
  17. ;---------------------------------------------------------------------------------------------------
  18. DebugGlobals     Record
  19.                 Export        pCanEnterDebugger, pUDebugInitialized, pSegTable
  20. pCanEnterDebugger DC.W        0                    ; Boolean: Debugger can be entered
  21. pUDebugInitialized DC.W        0                    ; Boolean: if Trace unit is inited
  22. pSegTable        DC.L        0                    ; HandleListHandle
  23.                 EndR                            ; Too bad Pascal doesn't have initialization
  24.  
  25.  
  26. ;---------------------------------------------------------------------------------------------------
  27. DevGlobals     Record
  28.                 Export        PFILENAME
  29. pPutProc        DC.L    0            ; Address of the PASCAL Proc to Handle WriteLn requests
  30.                                     ; Procedure DEVPUTTEXT(textBuf: Ptr, byteCount: longint);
  31. pGetProc        DC.L    0            ; Address of the PASCAL Proc to Handle Read requests
  32.                                     ; Function DEVGETTEXT(textBuf: Ptr, byteCount: longint): longint;
  33.  
  34. PFILENAME        DCB.B    256,0        ; FileName to intercept for console
  35.                 EndR
  36.  
  37.  
  38. ;-----------------------------------------------------------------------------------
  39. ;int DevFAccess(fName, cmd, arg)
  40. ;    char    *fName;
  41. ;    int     cmd;
  42. ;    char    *arg;
  43. ;{
  44. ;# define IgnoreCase         false
  45. ;# define DiacritSens     true
  46. ;
  47. ;/*
  48. ;    if ((equalstring(fName, PFILENAME, false, true)))
  49. ;*/
  50. ;        switch (cmd) {
  51. ;            default:
  52. ;                return(-1);
  53. ;            case F_OPEN:
  54. ;                return(0);
  55. ;        }
  56. ;/*
  57. ;    else
  58. ;        return(-1);
  59. ;*/
  60. ;}
  61. F_OPEN        EQU         (('d'<<8)|00)        ; for internal use only. Use only as directed.
  62.             Seg         'Main'
  63. EXPORT FUNCTION DevFAccess(fName:L, cmd:L, arg:L):L,C
  64.     BEGIN    SAVE=D2/D3,WITH=DevGlobals
  65.             Import        EQUALSTRING, P2CSTRPROC, C2PSTRPROC        ; library routines
  66.             MOVE.L    cmd(FP),D3
  67.             Call    C2PSTRPROC(fName(FP):L);
  68.             LEA        PFILENAME,A0
  69.             Call    EQUALSTRING:B(fName(FP):L, A0:L, #0:B, #1:B),D2
  70.             Call    P2CSTRPROC(fName(FP):L);
  71.             IF# D2 NE.B #0 THEN.S
  72.                 Switch# D3
  73.                 
  74.                 Case#.S    F_OPEN
  75.                         MOVEQ        #0,D0
  76.                         Leave#.S
  77.                 Default#
  78.                         MOVEQ        #-1,D0
  79.             
  80.                 EndS#            
  81.             ELSE#.S
  82.                 MOVEQ        #-1,D0
  83.             ENDIF#            
  84.  
  85.             RETURN     
  86.             EndF
  87.  
  88.  
  89. ;-----------------------------------------------------------------------------------
  90. ;int DevClose()
  91. ;{
  92. ;    return(0);
  93. ;}
  94.  
  95.             Seg         'Main'
  96. EXPORT FUNCTION DevClose:L,C
  97.         BEGIN
  98.             MOVEQ       #0,D0
  99.             Return
  100.             EndF
  101.  
  102.  
  103. ;-----------------------------------------------------------------------------------
  104.  
  105.             Seg         'Main'
  106. EXPORT FUNCTION SETGETPROC(theGetProc:L):L
  107.         BEGIN    with=DevGlobals
  108.             MOVE.L        pGetProc,SETGETPROC(FP)
  109.             MOVE.L        theGetProc(FP), pGetProc
  110.             Return
  111.             EndF
  112.  
  113. ;-----------------------------------------------------------------------------------
  114.  
  115.             Seg         'Main'
  116. EXPORT FUNCTION SETPUTPROC(thePutProc:L):L
  117.         BEGIN    with=DevGlobals
  118.             MOVE.L        pPutProc,SETPUTPROC(FP)
  119.             MOVE.L        thePutProc(FP), pPutProc
  120.             Return
  121.             EndF
  122.  
  123.  
  124. ;-----------------------------------------------------------------------------------
  125. ;int DevRead(iop)
  126. ;    IOPort    *iop;
  127. ;{
  128. ;    int     bytesRead;
  129. ;
  130. ;    bytesRead = DevReadLn(iop->inQ.bufp, iop->inQ.count);
  131. ;    iop->inQ.bufp += bytesRead;
  132. ;    iop->inQ.count -= bytesRead;
  133. ;    return(0);
  134. ;}
  135.  
  136.             Seg         'Main'
  137. EXPORT FUNCTION DevRead(iop:L):L,C
  138.     BEGIN with=DevGlobals,SAVE=D2/A2
  139.  
  140.             MOVE.L        iop(FP),A2
  141.  
  142. ;            CALL        (pGetProc):L($10(A2):L,$0E(A2):W),D0
  143.             MOVE.L        pGetProc, A0
  144.             CLR.L        -(SP)                ;make room for function result
  145.             MOVE.L        $10(A2), -(SP)
  146.             MOVE.W        $0E(A2), -(SP)
  147.             JSR            (A0)
  148.             MOVE.L        (SP)+,D0
  149.  
  150.             ADD.L        D0,$10(A2)            ;add it to bufp
  151.             SUB.L        D0,$0C(A2)             ;sub it from count
  152.             MOVEQ        #0,D0                ;Return value
  153.             RETURN
  154.             ENDF
  155.  
  156.  
  157. ;-----------------------------------------------------------------------------------
  158. ;int DevWrite(iop)
  159. ;    IOPort    *iop;
  160. ;{
  161. ;    DevAddText(iop->inQ.bufp, iop->inQ.count);
  162. ;    
  163. ;    return(0);
  164. ;}
  165.  
  166.             Seg         'Main'
  167. EXPORT FUNCTION DevWrite(iop:L):L,C
  168.     BEGIN with=DevGlobals,SAVE=D2/A2
  169.  
  170.             MOVE.L        iop(FP),A2
  171.  
  172. ;            CALL        (pPutProc)($10(A2):L,$0E(A2):W)
  173.             MOVE.L        pPutProc, A0
  174.             MOVE.L        $10(A2), -(SP)
  175.             MOVE.W        $0E(A2), -(SP)
  176.             JSR            (A0)
  177.  
  178.             CLR.L        $0C(A2)
  179.             MOVEQ        #0,D0                ;Return Value
  180.             RETURN
  181.             ENDF
  182.  
  183. ;-----------------------------------------------------------------------------------
  184. ;int DevIoctl(iop, cmd, arg)
  185. ;    IOPort    *iop;
  186. ;    int     cmd;
  187. ;    char    *arg;
  188. ;{
  189. ;    switch (cmd) {
  190. ;        case FIOINTERACTIVE:
  191. ;        case TIOFLUSH:
  192. ;            return(0);
  193. ;        default:
  194. ;            return(-1);
  195. ;    }
  196. ;}
  197.             Seg         'Main'
  198. EXPORT FUNCTION DevIoctl(iop:L, cmd:L, arg:L):L,C
  199.     BEGIN
  200.     Switch#    cmd(FP)
  201.             
  202.     Case#.S    FIOINTERACTIVE,TIOFLUSH
  203.             MOVEQ        #0,D0                ;Return Value
  204.             Leave#.S
  205.  
  206.     Default#
  207.             MOVEQ        #-1,D0                ;Return Value
  208.     EndS#
  209.  
  210.             RETURN     
  211.             EndF
  212.         
  213.                 End
  214.